﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Details.Master" CodeBehind="searchresults.aspx.vb" Inherits="AssignmentProject.searchresults" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  <style type="text/css">
  .friendSearch{width: 700px;margin:0 auto;}
  </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="server">
    <p>
        <br />
    </p>
    <p>
        If you found who you were looking for click on their profile pic to message 
        them!
    </p>
    <div class="friendSearch">
    <p>
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
            DataSourceID="SqlDataSource1" GroupItemCount="3">
            <AlternatingItemTemplate>
                <td runat="server" style="background-color: #FAFAD2;color: #284775;">
                    
                    <a href='message.aspx?DieterName=<%# Eval("DieterName") %>' />
                    <img width='200px' height='200px' src='<%# Eval("ProfilePicture") %>' />
                    </a><br />
                    <%# Eval("FirstName") %> <%# Eval("LastName") %>
                    <br />
                  
                   <%# Eval("DieterName") %>
                    <br />
                   
                </td>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <td runat="server" style="background-color: #FFCC66;color: #000080;">
                    ID:
                    <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                    <br />FirstName:
                    <asp:TextBox ID="FirstNameTextBox" runat="server" 
                        Text='<%# Bind("FirstName") %>' />
                    <br />LastName:
                    <asp:TextBox ID="LastNameTextBox" runat="server" 
                        Text='<%# Bind("LastName") %>' />
                    <br />Age:
                    <asp:TextBox ID="AgeTextBox" runat="server" Text='<%# Bind("Age") %>' />
                    <br />Description:
                    <asp:TextBox ID="DescriptionTextBox" runat="server" 
                        Text='<%# Bind("Description") %>' />
                    <br />StartingWeight:
                    <asp:TextBox ID="StartingWeightTextBox" runat="server" 
                        Text='<%# Bind("StartingWeight") %>' />
                    <br />TargetWeight:
                    <asp:TextBox ID="TargetWeightTextBox" runat="server" 
                        Text='<%# Bind("TargetWeight") %>' />
                    <br />
                    ProfilePicture:
                    <asp:TextBox ID="ProfilePictureTextBox" runat="server" 
                        Text='<%# Bind("ProfilePicture") %>' />
                    <br />
                    DieterName:
                    <asp:TextBox ID="DieterNameTextBox" runat="server" 
                        Text='<%# Bind("DieterName") %>' />
                    <br />
                    email:
                    <asp:TextBox ID="emailTextBox" runat="server" Text='<%# Bind("email") %>' />
                    <br />
                    password:
                    <asp:TextBox ID="passwordTextBox" runat="server" 
                        Text='<%# Bind("password") %>' />
                    <br />
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Update" />
                    <br />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Cancel" />
                    <br />
                </td>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" 
                    style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                    <tr>
                        <td>
                            Sorry, but we were unable to locate anyone using the details given.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <EmptyItemTemplate>
<td runat="server" />
            </EmptyItemTemplate>
            <GroupTemplate>
                <tr ID="itemPlaceholderContainer" runat="server">
                    <td ID="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </GroupTemplate>
            <InsertItemTemplate>
                <td runat="server" style="">
                    FirstName:
                    <asp:TextBox ID="FirstNameTextBox" runat="server" 
                        Text='<%# Bind("FirstName") %>' />
                    <br />LastName:
                    <asp:TextBox ID="LastNameTextBox" runat="server" 
                        Text='<%# Bind("LastName") %>' />
                    <br />Age:
                    <asp:TextBox ID="AgeTextBox" runat="server" Text='<%# Bind("Age") %>' />
                    <br />Description:
                    <asp:TextBox ID="DescriptionTextBox" runat="server" 
                        Text='<%# Bind("Description") %>' />
                    <br />StartingWeight:
                    <asp:TextBox ID="StartingWeightTextBox" runat="server" 
                        Text='<%# Bind("StartingWeight") %>' />
                    <br />TargetWeight:
                    <asp:TextBox ID="TargetWeightTextBox" runat="server" 
                        Text='<%# Bind("TargetWeight") %>' />
                    <br />
                    ProfilePicture:
                    <asp:TextBox ID="ProfilePictureTextBox" runat="server" 
                        Text='<%# Bind("ProfilePicture") %>' />
                    <br />
                    DieterName:
                    <asp:TextBox ID="DieterNameTextBox" runat="server" 
                        Text='<%# Bind("DieterName") %>' />
                    <br />
                    email:
                    <asp:TextBox ID="emailTextBox" runat="server" Text='<%# Bind("email") %>' />
                    <br />
                    password:
                    <asp:TextBox ID="passwordTextBox" runat="server" 
                        Text='<%# Bind("password") %>' />
                    <br />
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                        Text="Insert" />
                    <br />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Clear" />
                    <br />
                </td>
            </InsertItemTemplate>
            <ItemTemplate>
                <td runat="server" style="background-color: #FFFBD6;color: #333333;">
                  
                   <a href='message.aspx?DieterName=<%# Eval("DieterName") %>' />
                    <img width='200px' height='200px' src='<%# Eval("ProfilePicture") %>' />
                    </a><br />
                    <%# Eval("FirstName") %> <%# Eval("LastName") %>
                    <br />
                  
                   <%# Eval("DieterName") %>
                    <br />
                </td>
            </ItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table ID="groupPlaceholderContainer" runat="server" border="1" 
                                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                <tr ID="groupPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" 
                            style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
                            <asp:DataPager ID="DataPager1" runat="server" PageSize="12">
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                        ShowLastPageButton="True" />
                                </Fields>
                            </asp:DataPager>
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <td runat="server" 
                    style="background-color: #FFCC66;font-weight: bold;color: #000080;">
                    ID:
                    <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                    <br />FirstName:
                    <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />
                    <br />LastName:
                    <asp:Label ID="LastNameLabel" runat="server" Text='<%# Eval("LastName") %>' />
                    <br />Age:
                    <asp:Label ID="AgeLabel" runat="server" Text='<%# Eval("Age") %>' />
                    <br />Description:
                    <asp:Label ID="DescriptionLabel" runat="server" 
                        Text='<%# Eval("Description") %>' />
                    <br />StartingWeight:
                    <asp:Label ID="StartingWeightLabel" runat="server" 
                        Text='<%# Eval("StartingWeight") %>' />
                    <br />TargetWeight:
                    <asp:Label ID="TargetWeightLabel" runat="server" 
                        Text='<%# Eval("TargetWeight") %>' />
                    <br />
                    ProfilePicture:
                    <asp:Label ID="ProfilePictureLabel" runat="server" 
                        Text='<%# Eval("ProfilePicture") %>' />
                    <br />
                    DieterName:
                    <asp:Label ID="DieterNameLabel" runat="server" 
                        Text='<%# Eval("DieterName") %>' />
                    <br />
                    email:
                    <asp:Label ID="emailLabel" runat="server" Text='<%# Eval("email") %>' />
                    <br />
                    password:
                    <asp:Label ID="passwordLabel" runat="server" Text='<%# Eval("password") %>' />
                    <br />
                </td>
            </SelectedItemTemplate>
        </asp:ListView>
        
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            
            SelectCommand="SELECT [ID], [FirstName], [LastName], [Age], [Description], [ProfilePicture], [DieterName] FROM [Profile] WHERE ([DieterName] LIKE '%' + ? + '%')">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="search" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
      
    </p>
      </div>
</asp:Content>
